<?php
/**
 * @author 登陆验证类
 *
 */
class UserIdentity extends CUserIdentity {
	private $id = 0;
	private $ret = null;
	
	/**
	 *
	 * @see 验证登陆
	 * @return boolean|string
	 */
	public function authenticate() {
		$service = new SysAdminEntity ();
		$ret = $service->check_login ( $this->username, md5 ( $this->password ) );
		sys_debug_log ( $ret );
		if (false === $ret || ! is_numeric ( $ret )) {
			sys_debug_log ( "登录失败" );
			$this->id = 0;
			return false;
		} else {
			sys_debug_log ( "登录成功" );
			$this->id = $ret;
			return true;
		}
	}
	public function getId() {
		return $this->id;
	}
}